//
//  MJTGCell.m
//  团购
//
//  Created by app43 on 15/6/21.
//  Copyright (c) 2015年 www.xcu.edu.cn. All rights reserved.
//

#import "MJTGCell.h"
#import "MJTG.h"
@interface MJTGCell ()

@property (weak, nonatomic) IBOutlet UIImageView *iconView;//图片

@property (weak, nonatomic) IBOutlet UILabel *titleView;//标题

@property (weak, nonatomic) IBOutlet UILabel *priceLabel;//价格

@property (weak, nonatomic) IBOutlet UILabel *buyCountLabel;//团购人数

@end

@implementation MJTGCell

+ (instancetype)cellWithTableView:(UITableView *)tableView
{
    static NSString *ID = @"cell";
    MJTGCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    
    if (cell == nil) {
        
        cell = [[NSBundle mainBundle] loadNibNamed:@"MJTGCell" owner:nil options:nil][0];
        
    }
    
    return cell;
}

- (void)setTg:(MJTG *)tg
{
    _tg = tg;
    
    // 1.头像
    self.iconView.image = [UIImage imageNamed:tg.icon];
    
    // 2.标题
    self.titleView.text = tg.title;
    
    // 3.价格
    self.priceLabel.text = [NSString stringWithFormat:@"￥%@", tg.price];
    
    // 4.购买数
    self.buyCountLabel.text = [NSString stringWithFormat:@"%@人购买", tg.buyCount];
}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
